/*
 * Classname MultipleInstance.java
 * 
 * Version Information
 * Date Mar 27, 2006
 *
 * Copyright (c) AmSoft Systems, 2006
 */
package net.amsoft.iservice.isso.service.test;

import java.util.ArrayList;

import net.amsoft.iservice.isso.service.ISSOService;
import net.amsoft.iservice.util.exception.IServiceException;

/**
 * @author jyoti
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class MultipleInstance2
{
    private static String sIBrokerName = "isso.ibroker0.amsoft.co.in";
    private static String sPassword = "password";
    private static String sSessionToken = "sessionFor1";
    private static String sMachineToken = "MAchineFor1";

    public final static void testLogin(String sGlobalInumber) {

        try {
            ISSOService.login(sGlobalInumber, sPassword, sIBrokerName,
                    sSessionToken, sMachineToken, true);
        } catch (Exception e) {
            System.out
                    .print("testLoginWorksGoodForCorrectPwd() Isso does not login "
                            + "correctly");
            e.printStackTrace();
        }
    }

    private static void updateSynonyms(String sGlobalInumber, ArrayList asAdd,
            boolean bAdd) {
        try {

            if (bAdd)
                ISSOService.updateSynonyms(sGlobalInumber, asAdd, true);
            else
                ISSOService.updateSynonyms(sGlobalInumber, asAdd, false);
        } catch (Exception e) {

            e.printStackTrace();
        }
    }

    public static void main(String[] args) throws IServiceException,
            InterruptedException {

        String sGlobalInumber = "Multiple1";

        Thread.sleep((long) 2000);

        testLogin(sGlobalInumber);
        ArrayList al1 = new ArrayList();
        al1.add("Synonymj1");
        updateSynonyms(sGlobalInumber, al1, true);

    }
}